import {createStore,combineReducers,applyMiddleware} from 'redux'
import {countReducer,colorReducer} from './reducers'
import thunk from 'redux-thunk'
//combineReducers 可以把多个reducer合并成一个
let rootReducer = combineReducers({
  // countReducer,colorReducer
  qqq:countReducer,
  www:colorReducer
})
let store = createStore(rootReducer,applyMiddleware(thunk))
console.log(store.getState())
export default store










// function count(state,option){
//   // 纯函数
//   state = state || {count:100,name:666}
//   console.log(option)
//   switch (option.type) {
//     case 'add':
//       return {
//         ...state,
//         count:state.count + 1
//       }
//     case 'minus':
//       return {
//         ...state,
//         count:state.count - 1
//       }
  
//     default:
//       return state
//       break;
//   }
// }
